def is_prime(num):
    if num < 2:
        return False
    else:
        for i in range(2, int(num ** .5 + 1)):
            if num % i == 0:
                return False, i
        return True

def the_primes(low, limit):
    beforeprime = []
    primelist = []
    if low < 2:
        low = 2
    nums = [x for x in range(low, limit+1)]
    for i in nums:
        for j in range(2, int(i ** .5 + 1)):
            if i % j == 0:
                if i not in primelist:
                    beforeprime.append(i)
        if i not in beforeprime:
            primelist.append(i)
    if len(primelist) != 0:
        return primelist
    else:
        return "There are no primes in this list"

answer = input("Generate or Check for primes? [G/C]\n")
if answer.lower() == 'g':
    print (the_primes(int(input("Lower limit:\n")), int(input("Upper limit:\n"))))
elif answer.lower() == 'c':
    print (is_prime(input("Which number would you like to check?\n")))

